#build stage
FROM golang:alpine AS builder
WORKDIR /app
COPY . .
ENV GO111MODULE=on GOPROXY="https://goproxy.cn,direct"
RUN go mod download
RUN go build -o /app/docker-app

#final stage
FROM alpine:latest
ENV GIN_MODE=release PORT=80
# RUN apk --no-cache add ca-certificates
COPY --from=builder /app/docker-app /app/docker-app
ENTRYPOINT /app/docker-app
EXPOSE 80
